|
|
@@ -73,12 +73,14 @@ module Agents
|
73
|
73
|
|
74
|
74
|
def check_this_url(url, local_headers)
|
75
|
75
|
# Track time
|
76
|
|
- measured_result = TimeTracker.track { ping(url) }
|
|
76
|
+ start = Time.now.to_f
|
|
77
|
+ measured_result = ping(url)
|
|
78
|
+ total_time = Time.now.to_f - start
|
77
|
79
|
|
78
|
80
|
current_status = measured_result.result ? measured_result.status.to_s : ''
|
79
|
81
|
return if options['changes_only'] == 'true' && current_status == memory['last_status'].to_s
|
80
|
82
|
|
81
|
|
- payload = { 'url' => url, 'response_received' => false, 'elapsed_time' => measured_result.elapsed_time }
|
|
83
|
+ payload = { 'url' => url, 'response_received' => false, 'elapsed_time' => total_time }
|
82
|
84
|
|
83
|
85
|
# Deal with failures
|
84
|
86
|
if measured_result.result
|
|
|
@@ -108,25 +110,4 @@ module Agents
|
108
|
110
|
end
|
109
|
111
|
end
|
110
|
112
|
|
111
|
|
- # Clock that cannot be set and represents monotonic time since
|
112
|
|
- # some unspecified starting point.
|
113
|
|
- #
|
114
|
|
- # @!visibility private
|
115
|
|
- GLOBAL_MONOTONIC_CLOCK = class_definition.new
|
116
|
|
- private_constant :GLOBAL_MONOTONIC_CLOCK
|
117
|
|
-
|
118
|
|
- # @!macro [attach] monotonic_get_time
|
119
|
|
- #
|
120
|
|
- # Returns the current time a tracked by the application monotonic clock.
|
121
|
|
- #
|
122
|
|
- # @return [Float] The current monotonic time when `since` not given else
|
123
|
|
- # the elapsed monotonic time between `since` and the current time
|
124
|
|
- #
|
125
|
|
- # @!macro monotonic_clock_warning
|
126
|
|
- def monotonic_time
|
127
|
|
- GLOBAL_MONOTONIC_CLOCK.get_time
|
128
|
|
- end
|
129
|
|
-
|
130
|
|
- module_function :monotonic_time
|
131
|
|
-
|
132
|
113
|
end
|